<div class="modal fade bs-modal-md" id="modelContent">
	<div class="modal-dialog modal-md" style="width: 800px;">
		<div class="modal-content"></div>
	</div>
</div>

<div class="portlet box green">
	<div class="portlet-title">
		<div class="caption">
			<i class="fa fa-cogs"></i>企业管理&gt; 营业执照信息&gt; 编辑
		</div>
		<div class="tools">
			<a href="javascript:;" class="collapse" data-original-title=""
				title=""> </a>
		</div>
	</div>
	<div class="portlet-body">
		<div class="tabbable-line ">
			<ul class="nav nav-tabs">
	            <li class="">
	            <a href="/company/edit?id=$!company.id" class="ajaxify" ><font style="vertical-align: inherit;"><font
				   style="vertical-align: inherit;"> 企业信息编辑 </font></font></a></li>
	            <li class="">
	            <a href="/company/userinfoEdit?companyId=$!company.id"  class="ajaxify" ><font style="vertical-align: inherit;"><font
				    style="vertical-align: inherit;"> 负责人信息编辑</font></font></a></li>
	            <li class="active">
	            <a href="/company/licenseEdit?companyid=$!company.id" class="ajaxify"  ><font style="vertical-align: inherit;"><font
				    style="vertical-align: inherit;"> 营业执照信息编辑</font></font></a></li>
            </ul>
		</div>
		<span></span>
	 </div>
    <div class="portlet-body form">
    	<form role="form" action="/company/licenseEdit" class="form-horizontal" method="post">
                 <div class="form-body">
        	     <div class="form-group">
                     <label class="control-label col-md-3">*统一社会信用代码：</label>
                     <div class="col-md-5">
                         <input type="hidden" class="form-control" name="id" value="$!company.licenseId">	
                         <input type="text" class="form-control" name="registration" value="$!company.licenseId" required>
                     	 <input type="hidden" class="form-control" name="companyid" value="$!company.id">	
                     </div>
                 </div>
	        	 <div class="form-group">
					<label class="control-label col-md-3">*营业执照电子版：</label>
					<div class="col-md-4">
	                    <div class="mt-element-overlay">
							<div class="mt-overlay-1 fileinput fileinput-new" data-provides="fileinput" style="margin-bottom: 0;width: auto;;height: auto;">
								<div class="fileinput-new thumbnail" style="width: 150px; height: 150px; margin-bottom: 0">
								    <img src="$!item.image" alt="上传图片"> 
								</div>
								<div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 150px; max-height: 150px;margin-bottom: 0"> </div>
								<div class="mt-overlay">
								    <span class="btn default btn-file" style="padding: 0;">
									    <span class="fileinput-new"> 浏览 </span>
									    <span class="fileinput-exists"> 更改 </span>
									    <input type="file" class="uploadProdImage"   accept="image/jpg,image/gif,image/bmp,image/jpeg,image/png">  
								    <input type="hidden" value="$!item.image" name="image" id="shareInfoImage">
								    </span>`
								    <a href="javascript:;" class="btn red fileinput-exists" data-dismiss="fileinput" style="padding: 0"> 删除 </a>
								</div>
                        	</div>
						</div>
					</div>
				</div>
				  <div class="form-group">
					 <label class="control-label col-md-3">成立日期：</label> 
					 <div class="col-md-2">
							<input class="form-control" type="text" name="startTime" id="startTime" value="$!item.startTime">
							<i class="fa fa-calendar" style="position: absolute;right: 10px;top: 10px"></i>
					</div>
					<label class="control-label col-md-1">有效日期：</label>
					<div class="col-md-2">
							<input class="form-control" type="text" name="endTime" id="endTime" value="$!item.endTime">
							<i class="fa fa-calendar" style="position: absolute;right: 10px;top: 10px"></i>
					</div>
				</div>
                 <div class="form-group">
                     <label class="control-label col-md-3">注册资本：</label>
                     <div class="col-md-5">
                         <input type="number" class="form-control integerNum"  name="capital" value="$!item.capital">
                     </div>
                 </div>        
                 <div class="form-group">
 					<label class="control-label col-md-3">注册地区：</label>
 					<div class="col-md-5">
 						<div id="element_id" class="row">
 						  <div class="col-md-4">
						  	<select name="province" class=" form-control  province">
						  		<option value="$!item.province"></option>
						  	</select>
						  </div>
						  <div class="col-md-4">
						  	<select name="city"  class=" form-control  city">
						  		<option value="$!item.city"></option>
						  	</select>
						  </div>
						  <div class="col-md-4">
						  	<select name="county"   class=" form-control  area">
						  		<option value="$!item.county"></option>
						  	</select>
						  </div>
						</div>
 					</div>
 				 </div>	
 				 
                 <div class="form-group">
                     <label class="control-label col-md-3">详细地址：</label>
                     <div class="col-md-5">
                         <input type="text" class="form-control" name="address"  value="$!item.address">
                     </div>
                 </div>
                 <div class="form-group">
                     <label class="control-label col-md-3">*法人姓名：</label>
                     <div class="col-md-5">
                         <input type="text" class="form-control" name="name" required value="$!item.name">
                     </div>
                 </div>
                 <div class="form-group">
                     <label class="control-label col-md-3">*身份证号：</label>
                     <div class="col-md-5">
                         <input type="text" class="form-control" required name="idCard" value="$!item.idCard" maxlength="18" onkeyup="this.value=this.value.replace(/\D/g,'')"  onafterpaste="this.value=this.value.replace(/\D/g,'')" placeholder="请输入数字不少于18位">
                     </div>
                 </div>  
                 <div class="form-group">
					<label class="control-label col-md-3">*身份证电子版：</label>
					<div class="col-md-4">
	                    <div class="mt-element-overlay">
							<div class="mt-overlay-1 fileinput fileinput-new" data-provides="fileinput" style="margin-bottom: 0;width: auto;;height: auto;">
								<div class="fileinput-new thumbnail" style="width: 150px; height: 150px; margin-bottom: 0">
								    <img src="$!item.idCardImage" alt="上传图片"> 
								</div>
								<div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 150px; max-height: 150px;margin-bottom: 0"> </div>
								<div class="mt-overlay">
								    <span class="btn default btn-file" style="padding: 0;">
									    <span class="fileinput-new"> 浏览 </span>
									    <span class="fileinput-exists"> 更改 </span>
									    <input type="file"  class="uploadProdImage" accept="image/jpg,image/gif,image/bmp,image/jpeg,image/png" required>  
									     <input type="hidden" name="idCardImage"  value="$!item.idCardImage"  />
								    </span>`
								    <a href="javascript:;" class="btn red fileinput-exists" data-dismiss="fileinput" style="padding: 0"> 删除 </a>
								</div>
                        	</div>
						</div>
					</div>
				</div>     
			  </div> 
            <div class="form-actions right">
				<a href="javascript:;" thref="/company/list" class="btn green ajax-post"><i class="fa fa-check"></i> 提交</a>
				<a href="/company/list" class="btn btn-outline grey-salsa ajaxify">返回</a>
            </div>
        </form>   
    </div>
</div>
<script src="/assets/scripts/views-date.js" type="text/javascript"></script>
<script type="text/javascript">
$('#element_id').cxSelect({
  url: '/assets/plugins/cxSelect-master/js/cityData.min.json',               // 如果服务器不支持 .json 类型文件，请将文件改为 .js 文件
  selects: ['province', 'city', 'area'],  // 数组，请注意顺序
  emptyStyle: 'none'
});
MyTouchSpin.init()


$(".uploadProdImage").on("change", function() {
	var target= $(this);
	var files = this.files;
	var formData = new FormData();
	for (var i = 0; i < files.length; i++) {
		var fileSize = parseInt(files[i].size / 1024).toFixed(0);
		if (fileSize > 1024) {
			toastr.warning("单张图片大小不要超过1M");
			return false
		}
		formData.append("file", files[i]);
	}
	;
	$.ajax({
		url : "/upload-shareInfo",
		type : "post",
		data : formData,
		contentType : false,
		processData : false,
		dataType : "html",
		success : function(res) {
			var data = JSON.parse(res);
			target.next().attr('value', data.url);
		}
	})
})
</script>
 